
import { ElLink } from 'element-plus';
import { h } from 'vue';
import Server from './Server.js'
//扩展ElImage, 处理图片路径， 比如说根据store.getUrl配置，访问OSS服务器上的路径
export default {
    name: "MyLink",
    inheritAttrs: true,
    extends: ElLink,
    emits:["click"],
    props:{
        modelValue:{
            type:[Number,String],
            default:"链接"
        },
        formData:Object,
        tbname:String,
        onClick:Function
    },
    methods:{
        defaultClick(){
            if(this.onClick){
                this.onClick.apply(this);
                return;
            }
            if(this.tbname && this.modelValue){
                Server.dlg.view(this.tbname, this.modelValue);
            }
        }
    },
    render() {
        let props = { ...this.$attrs, ...this.$props };
        props.onClick = this.defaultClick;
        return h(ElLink, props, ()=>this.modelValue);
    }
}
